from django.db import models


# Create your models here.
class DgutOrder(models.Model):
    username = models.CharField('学工号', max_length=128)
    name = models.CharField(max_length=125, blank=True, null=True)
    acc_tr_type_choice = (
        ('1', '主账户'),
        ('2', '餐次'),
        ('3', '补助金')
    )
    acc_tr_type = models.CharField('账户类型', choices=acc_tr_type_choice, max_length=4)
    number = models.IntegerField('数量')
    bill_amt = models.IntegerField('交易金额')
    acc_tr_amt = models.CharField('实际支付金额', max_length=255, blank=True, null=True)

    status_choice = (
        (1, '待支付'),
        (2, '已支付'),
        (3, '交易关闭'),
    )
    status = models.IntegerField('状态', choices=status_choice)
    remarks = models.CharField('备注', max_length=255, blank=True, null=True)
    pay_result = models.TextField('支付报文', blank=True, null=True)
    create_time = models.DateTimeField('创建时间', blank=True, null=True)
    update_time = models.DateTimeField('更新时间', blank=True, null=True)

    class Meta:
        managed = False
        db_table = 'order'
        verbose_name = '疫情捐款明细表'
        verbose_name_plural = '疫情捐款明细表'


class DonationStatistics(models.Model):
    username = models.CharField('学工号', max_length=128, primary_key=True)
    name = models.CharField('姓名', max_length=50, blank=True, null=True)
    times = models.BigIntegerField('捐款次数')
    amount = models.FloatField('捐款总额', blank=True, null=True)

    class Meta:
        managed = False  # Created from a view. Don't remove.
        db_table = 'donation_statistics'
        verbose_name = '个人捐款统计表'
        verbose_name_plural = '个人捐款统计表'


class Summaries(models.Model):
    name = models.CharField('项目', max_length=6, primary_key=True)
    value = models.FloatField('内容', blank=True, null=True)

    class Meta:
        managed = False  # Created from a view. Don't remove.
        db_table = 'summaries'
        verbose_name = '全校捐款统计表'
        verbose_name_plural = '全校捐款统计表'
